//
//  DiscoverService.m
//  FM
//
//  Created by 王方伟 on 2017/12/5.
//  Copyright © 2017年 wfw. All rights reserved.
//

#import "DiscoverService.h"
#import "SHHttpUtil.h"
#import "MJExtension.h"

@implementation DiscoverService

#pragma mark 获取发现标题
+ (NSURLSessionDataTask *)getDistcoverTitleWith:(DiscoverRequest *)request success:(void (^)(DiscoverResponse *))success failure:(void (^)(NSError *))failure{
    NSString *url = [NSString stringWithFormat:@"%@mobile/discovery/v1/tabs", kBaseUrl];
    return [SHHttpUtil getWithURL:url params:request.mj_keyValues success:^(id responseObject) {
        DiscoverResponse *response = [DiscoverResponse mj_objectWithKeyValues:responseObject];
        if (success) {
            success(response);
        }
    } failure:^(NSError *failure) {
        
    }];
}

#pragma mark 获取榜单模块广告列表
+ (NSURLSessionDataTask *)getFocusListWith:(RecommendRequest *)request success:(void (^)(RecommendResponse *))success failure:(void (^)(NSError *))failure{
    NSString *url = [NSString stringWithFormat:@"%@mobile/discovery/v4/recommends", kBaseUrl];
    return [SHHttpUtil getWithURL:url params:request.mj_keyValues success:^(id responseObject) {
        RecommendResponse *response = [RecommendResponse mj_objectWithKeyValues:responseObject];
        if (success) {
            success(response);
        }
    } failure:^(NSError *failure) {
        
    }];
}
@end
